home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / utils / gemfut15.lzh / AESUTOB1.C < prev    next >
C/C++ Source or Header  |  1989-08-27  |  3KB  |  90 lines

  1.  
  2. /**************************************************************************
  3.  *
  4.  * AESFAST PD utilties.
  5.  *
  6.  *  Object-related utilities 1...
  7.  *    obj_flchange
  8.  *    obj_stchange
  9.  *************************************************************************/
  10.  
  11. #include <gemfast.h>
  12.  
  13. /*-------------------------------------------------------------------------
  14.  * obj_flchange - Change ob_flags, with optional redraw.
  15.  *-----------------------------------------------------------------------*/
  16.  
  17. void
  18. obj_flchange(ptree, object, newflags, drawflag)
  19.     register OBJECT *ptree;
  20.     int             object;
  21.     int             newflags;
  22.     int             drawflag;
  23. {
  24.     GRECT           clip_rect;
  25.     
  26. /*
  27.  * check the newflags value. if the high bit is set, AND the newflags
  28.  * with the current flags, else OR them.
  29.  */
  30.  
  31.     if (newflags & 0x8000) {
  32.         ptree[object].ob_flags &= newflags;
  33.     }
  34.     else {
  35.         ptree[object].ob_flags |= newflags;
  36.     }
  37.  
  38. /* 
  39.  * if drawflag is true, we need to do a redraw starting at the changed
  40.  * object's tree root (this is in case the HIDETREE flag is being changed),
  41.  * but the redraw must be clipped by the object we're trying to update.
  42.  * we get the screen x/y/w/h of the object, and expand it by 3 pixels to
  43.  * allow for shadowed, outlined, etc, and use it as a clipping rectangle
  44.  * for the objc_draw.
  45.  */
  46.  
  47.     if (drawflag) {
  48.         obj_offxywh(ptree, object, &clip_rect);
  49.         rc_gadjust(&clip_rect, 3, 3); 
  50.         objc_draw(ptree, R_TREE, MAX_DEPTH, clip_rect);
  51.     }
  52. }
  53.  
  54. /*-------------------------------------------------------------------------
  55.  * obj_stchange - Change ob_state, with optional redraw.
  56.  *-----------------------------------------------------------------------*/
  57.  
  58. void
  59. obj_stchange(ptree, object, newstate, drawflag)
  60.     register OBJECT *ptree;
  61.     int             object;
  62.     int             newstate;
  63.     int             drawflag;
  64. {
  65.     GRECT           clip_rect;
  66.     
  67. /*
  68.  * check the newstate value. if the high bit is set, AND the newstate
  69.  * with the current state, else OR them.
  70.  */
  71.  
  72.     if (newstate & 0x8000) {
  73.         ptree[object].ob_state &= newstate;
  74.     }
  75.     else {
  76.         ptree[object].ob_state |= newstate;
  77.     }
  78.  
  79. /*
  80.  * if the drawflag is set, redraw the object.  Use the x/y/w/h of the
  81.  * root object as the clipping rectangle for the redraw.
  82.  */
  83.  
  84.     if (drawflag) {
  85.         obj_offxywh(ptree, R_TREE, &clip_rect);
  86.         objc_draw(ptree, object, MAX_DEPTH, clip_rect);
  87.     }
  88. }
  89.  
  90.